:root {
    --primary-color: #4361ee;
    --primary-light: #4361ee;
    --success-color: #00b894;
    --error-color: #d63031;
    --text-color: #495057;
    --text-light: #636e72;
    --bg-color: #f5f6fa;
    --card-color: #ffffff;
    --system-bubble: #ffffff;
    --user-bubble: #dfe6e9;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --radius: 10px;
    --small-radius: 8px;
    --base-font-size: 14px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

/* 顶部导航栏 */
.chat-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    position: relative;
    box-shadow: var(--shadow);
    z-index: 10;
}

.back-button {
    color: white;
    font-size: 20px;
    margin-right: 15px;
    text-decoration: none;
}

.chat-info {
    flex: 1;
    display: flex;
    align-items: center;
}

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    margin-right: 12px;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.chat-title {
    font-size: 18px;
    font-weight: 600;
}

.chat-status {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 2px;
}

.chat-actions {
    display: flex;
    gap: 15px;
}

.chat-action {
    color: white;
    font-size: 18px;
    text-decoration: none;
}

/* 消息列表容器 */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at 1px 1px, rgba(0, 0, 0, 0.05) 1px, transparent 0);
    background-size: 20px 20px;
}

/* 消息行 */
.message-row {
    display: flex;
    margin-bottom: 20px;
}

/* 收到的消息 */
.message-row.received {
    justify-content: flex-start;
}

/* 发送的消息 */
.message-row.sent {
    justify-content: flex-end;
}

/* 消息容器 */
.message-container {
    display: flex;
    max-width: 85%;
}

.message-row.sent .message-container {
    flex-direction: row-reverse;
}

/* 头像 */
.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    margin-top: auto;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow);
}

.message-row.received .message-avatar {
    margin-right: 12px;
}

.message-row.sent .message-avatar {
    margin-left: 12px;
}

/* 消息内容区域 */
.message-content-area {
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 消息气泡 */
.message-content {
    padding: 14px 18px;
    border-radius: var(--radius);
    position: relative;
    word-wrap: break-word;
    box-shadow: var(--shadow);
    line-height: 1.5;
}

/* 系统消息 */
.received .message-content {
    background-color: var(--system-bubble);
    color: var(--text-color);
    border-top-left-radius: var(--small-radius);
    border-bottom-right-radius: var(--radius);
    border-bottom-left-radius: var(--radius);
}

/* 用户消息 */
.sent .message-content {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border-top-right-radius: var(--small-radius);
    border-bottom-right-radius: var(--radius);
    border-bottom-left-radius: var(--radius);
}

/* 消息元信息 */
.message-meta {
    display: flex;
    align-items: center;
    font-size: 11px;
    color: var(--text-light);
    margin-top: 8px;
}

.sent .message-meta {
    justify-content: flex-end;
}

.message-time {
    margin-left: 6px;
    font-weight: 500;
}

.received .message-time {
    color: var(--text-light);
}

.sent .message-time {
    color: var(--primary-light);
}

/* 问题提示 */
.question-hint {
    font-size: 14px;
    color: var(--text-light);
    margin: 12px 0 8px;
    padding: 10px 14px;
    background-color: rgba(0, 0, 0, 0.03);
    border-radius: var(--small-radius);
    display: inline-block;
    border-left: 3px solid var(--primary-light);
}

/* 输入框容器 */
.question-input-container {
    display: flex;
    margin-top: 15px;
    /*padding: 0 10px;*/
    flex-direction: column;
    gap: 10px;
}

/* 文本输入框 */
.question-input-field {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 15px;
    outline: none;
    transition: border 0.3s;
}

.question-input-field:focus {
    border-color: var(--primary-light);
}

/* 日期输入框 */
.question-date-field {
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 15px;
    outline: none;
    transition: border 0.3s;
}

.question-date-field:focus {
    border-color: var(--primary-light);
}

/* 选项按钮 */
.options-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    /*flex-direction: column;
    align-items: flex-start;*/
}

.option-button {
    padding: 12px 18px;
    background-color: white;
    border: none;
    border-radius: 10px;
    color: var(--text-color);
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 多选选项按钮 */
.multi-option-button {
    padding: 12px 18px;
    background-color: white;
    border: 2px solid #ddd;
    border-radius: 10px;
    color: var(--text-color);
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.multi-option-button.selected {
    background-color: var(--primary-light);
    color: white;
    border-color: var(--primary-color);
}

.option-button:hover,
.multi-option-button:hover {
    background-color: var(--primary-light);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.2);
}

/* 多选提交按钮 */
.multi-submit-button {
    margin-top: 15px;
    padding: 12px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    align-self: flex-end;
}

.multi-submit-button:hover {
    background-color: var(--primary-light);
}

/* 发送按钮 */
.question-send-button {
    padding: 12px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    align-self: flex-end;
}

.question-send-button:hover {
    background-color: var(--primary-light);
}

/* 进度指示 */
.progress-indicator {
    text-align: center;
    font-size: 13px;
    color: var(--text-light);
    margin: 20px 0 10px;
    position: relative;
}

.progress-indicator::before,
.progress-indicator::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 30%;
    height: 1px;
    background-color: rgba(0, 0, 0, 0.1);
}

.progress-indicator::before {
    left: 0;
}

.progress-indicator::after {
    right: 0;
}

/* 加载动画 */
.typing-indicator {
    display: flex;
    padding: 14px 20px;
    background-color: var(--system-bubble);
    border-radius: var(--radius-md);
    width: fit-content;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    align-items: center;
}

.typing-text {
    margin-right: 12px;
    font-size: 14px;
    color: var(--text-light);
}

.typing-dots {
    display: flex;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background-color: var(--primary-light);
    border-radius: 50%;
    margin: 0 4px;
    animation: typingAnimation 1.6s infinite ease-in-out;
}

@keyframes typingAnimation {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.6; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* 反馈消息 */
.feedback-correct {
    background-color: var(--success-color) !important;
    color: white !important;
}

.feedback-incorrect {
    background-color: var(--error-color) !important;
    color: white !important;
}

/* 完成消息 */
.completion-message {
    text-align: center;
    padding: 20px;
    margin: 20px 0;
    background-color: var(--card-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.completion-message h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.completion-message p {
    color: var(--text-light);
    font-size: 14px;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* 响应式调整 */
@media (max-width: 480px) {
    .messages-container {
        padding: 15px;
    }

    .message-container {
        max-width: 90%;
    }

    .message-content {
        padding: 12px 16px;
    }

    .message-avatar {
        width: 32px;
        height: 32px;
    }

    .question-input-field,
    .question-date-field {
        padding: 10px 14px;
        font-size: 14px;
    }

    .option-button,
    .multi-option-button {
        padding: 10px 14px;
        font-size: 14px;
    }

    .question-send-button,
    .multi-submit-button {
        padding: 10px 15px;
        font-size: 14px;
    }
}

/* 问诊结果 */
.result-span-title {
    font-weight: bold;
    color: var(--success-color) !important;
}

.result-span-text {
    display: block;
    /*padding-left: 20px;*/
}